﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace pb_ws_client
{
    class LogicLayer
    {
        public static string SID;
        public static string UID;
        public static string Web = "http://sse.tongji.edu.cn/spb/";
        private static DataTable DT_PERSON;
        public static DataTable dt_person
        {
            get { return DT_PERSON; }
            set {
                    DT_PERSON = value;
                    DT_PERSON.Columns[0].ColumnName = "编号";
                    DT_PERSON.Columns[1].ColumnName = "登录名";
                    DT_PERSON.Columns[2].ColumnName = "姓名";
                    DT_PERSON.Columns[3].ColumnName = "性别";
                    DT_PERSON.Columns[4].ColumnName = "民族";
                    DT_PERSON.Columns[5].ColumnName = "出生日期";
                    DT_PERSON.Columns[6].ColumnName = "身份证号";
                    DT_PERSON.Columns[7].ColumnName = "电话";
                    DT_PERSON.Columns[8].ColumnName = "电子邮箱";
                    
                    DT_PERSON.Columns.Add("权限",typeof(string));
                    
                    foreach (DataRow dr in DT_PERSON.Rows)
                    {
                        switch (Convert.ToInt32(dr["PRIORITY_ID"]))
                        {
                            case 1:
                                dr["权限"] = "游客";
                                break;
                            case 2:
                                dr["权限"] = "党员/预备党员";
                                break;
                            case 3:
                                dr["权限"] = "支部书记";
                                break;
                            case 4:
                                dr["权限"] = "总支书";
                                break;
                        }
                    }

                    DT_PERSON.Columns.Remove("PRIORITY_ID");
                }
        }
        private static DataTable DT_BRANCH;
        public static DataTable dt_branch
        {
            get { return DT_BRANCH; }
            set {
                DT_BRANCH = value;
                DT_BRANCH.Columns[0].ColumnName = "编号";
                DT_BRANCH.Columns[1].ColumnName = "年份";
                DT_BRANCH.Columns[2].ColumnName = "支部名称";    
            }
        }
        private static DataTable DT_POST;
        public static DataTable dt_post
        {
            get { return DT_POST;  }
            set{
                DT_POST = value;
                DT_POST.Columns[0].ColumnName = "编号";
                DT_POST.Columns[1].ColumnName = "板块";
                DT_POST.Columns[2].ColumnName = "标题";
                DT_POST.Columns[3].ColumnName = "作者";
                DT_POST.Columns[4].ColumnName = "发布时间";
            }
        }
        private static DataTable DT_REPLY;
        public static DataTable dt_reply
        {
            get { return DT_REPLY; }
            set{
                DT_REPLY = value;
                DT_REPLY.Columns[0].ColumnName = "编号";
                DT_REPLY.Columns[1].ColumnName = "内容";
                DT_REPLY.Columns[2].ColumnName = "作者";
                DT_REPLY.Columns[3].ColumnName = "发布时间";
            }
        }
    }
}
